home *** CD-ROM | disk | FTP | other *** search
- Path: news.crystalball.com!news
- From: Larry Weiss <lfw@oc.com>
- Newsgroups: comp.sources.wanted,comp.lang.c,comp.unix.programmer
- Subject: Re: Seek unix2dos.c OR help with tr
- Date: Thu, 14 Mar 1996 15:27:43 -0600
- Organization: crystalball.com
- Message-ID: <31488F4F.726E@oc.com>
- References: <4i0946$7io@nuke.csu.net> <danpop.826545577@rscernix> <4i9dj4INN7kl@keats.ugrad.cs.ubc.ca> <4ia0kj$d8s@solutions.solon.com>
- NNTP-Posting-Host: external.oc.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win16; I)
- CC: lfw@oc.com
-
- Peter Seebach wrote:
- >
- > In article <4i9dj4INN7kl@keats.ugrad.cs.ubc.ca>,
- > Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
- > >When I know that I'm specifically dealing with ASCII control chars, I have a
- > >macro like:
- > >#define CTRL(C) ((C)-64)
- > >which I then use with capital letters:
- > > switch(char) {
- > > case CTRL('M'):
-
- >
- > I always use
- > #define CTRL(x) ((x) & 0x1f)
- > because this preserves the likely semantics of CTRL.
-
- Peter, Is this just a matter of self-evident documentation of the
- macro definition?
-
- Dan Pop, how would have coded Kazimir's example to avoid the
- reference to the magic-number 64 -and- how would you have coded
- Peter's alternative that uses magic-number 0x1f ?
-